<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div
      class="content-parent border-hover-style"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style10/Auxiliaryoutlinestyle3Bg.webp'})`,
      }"
    >
      <div class="audio-parent">
        <audioCom :info="props.info" ref="audioParent" />
      </div>

      <div
        class="content"
        :class="{
          content2:
            !props.info.value &&
            !props.info.remarks &&
            !(props.info.video && props.info.video.url) &&
            !props.info.subTitle,
          content3:
            !props.info.value &&
            !props.info.remarks &&
            !(props.info.video && props.info.video.url) &&
            props.info.subTitle,
        }"
      >
        <div class="title-box">
          <img :src="publicUrls + 'free/style10/Auxiliaryoutlinestyletitle3Bg1.webp'" alt="" />
          <p>{{ props.info.text }}</p>
          <img :src="publicUrls + 'free/style10/Auxiliaryoutlinestyletitle3Bg2.webp'" alt="" />
        </div>
        <p class="subtitle" v-if="props.info.subTitle">{{ props.info.subTitle }}</p>
        <div
          v-if="(props.info.video && props.info.video.url) || props.info.value"
          class="img-box"
          :class="{
            'img-box1': props.info.remarks && !props.info.subTitle,
            'img-box2': !props.info.remarks && props.info.subTitle,
            'img-box3': !props.info.remarks && !props.info.subTitle,
          }"
        >
          <videoview
            @click="audioplay(false)"
            :info="props.info"
            v-if="props.info.video && props.info.video.url"
          ></videoview>
          <div v-else class="outline-cover">
            <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
          </div>
        </div>

        <div class="remarks1" v-if="(props.info.video && props.info.video.url) || props.info.value">
          <TextMax
            :color2="false"
            :infoData="props.info"
            v-if="props.domShow"
            :data="props.info.remarks"
            :title="props.info.text"
            :row="3"
          ></TextMax>
        </div>
        <div class="remarks2" :class="{ remarks3: !props.info.subTitle }" v-else-if="props.info.remarks">
          <TextMax
            :color2="false"
            :infoData="props.info"
            v-if="props.domShow"
            :data="props.info.remarks"
            :title="props.info.text"
            :row="props.info.subTitle ? 6 : 8"
          ></TextMax>
        </div>
      </div>
    </div>
  </div>
</template>



<script setup lang="ts">
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/textMax10.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  margin-top: 0;
  height: 100%;
  margin-right: 140px;
}
.content-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 32px;
  width: 360px;
  height: 447px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 34% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.audio-parent {
  position: absolute;
  bottom: 0px;
  right: 39px;
  width: 82px;
  height: 60px;
}
.content {
  position: relative;
  display: flex;
  flex-direction: column;

  width: 360px;
  height: 447px;
  padding: 46px 30px 10px 20px;
}
.content2 {
  // justify-content: center;
  padding-left: 30px;
  .title-box {
    margin-top: calc(184px - 46px);
  }
}
.content3 {
  padding-top: 165px;
  // justify-content: center;
  // .title-box{
  //   margin-top: calc(192px - 55px);
  // }
  .subtitle {
    width: 270px;
    margin-top: 10px;
  }
}
.title-box {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 218px;

  img {
    width: 28px;
    height: 36px;
    object-fit: contain;
  }
  :deep(p) {
    max-width: 162px;
    font-family: SJxingkai-C;
    font-size: 22px;
    color: rgba(57, 56, 54, 1);
    line-height: 26px;
    letter-spacing: -0.1em;
    text-align: center;
  }
}

.subtitle {
  width: 270px;
  font-family: PingFang SC;
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
  color: rgba(57, 56, 54, 1);
  text-align: left;
  margin-top: 10px;
  opacity: 0.7;
  font-weight: 550;
}
.img-box {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  width: 265px;
  height: 117px;
  background: rgba(2, 2, 2, 0.1);
  :deep(video) {
    background: rgba(2, 2, 2, 0.1);
  }
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }
}
.img-box:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}
.img-box1 {
  height: 183px;
}
.img-box2 {
  height: 171px;
}
.img-box3 {
  height: 224px;
  margin-top: 23px;
}

.remarks1 {
  margin-top: 10px;
  width: 226px;
  :deep(.van-text-ellipsis) {
  }
}

.remarks2 {
  margin-top: 10px;
  width: 256px;
}
.remarks3 {
  width: 256px;
  margin-top: 10px;
}
</style>
